/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managedbean.SCM.Supplier;

import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import org.primefaces.component.chart.series.ChartSeries;
import org.primefaces.model.chart.CartesianChartModel;
import org.primefaces.model.chart.PieChartModel;

/**
 *
 * @author Jing Guo
 */
@ManagedBean(name="chartSupplier")
@ViewScoped
public class chartSupplierManagedBean implements Serializable{

//    /** Creates a new instance of chartSupplierManagedBean */
//    public chartSupplierManagedBean() {
//        createSupplyItem();
//    }
//    
//    private PieChartModel pie;
//
//    public PieChartModel getPie() {
//        return pie;
//    }
//
//    private void createSupplyItem(){
//        pie = new PieChartModel();
//        pie.set("a", 90);
//        pie.set("b", 40);
//        pie.set("c", 50);
//    }

     
  
    private CartesianChartModel cartesianModel;  
  
    private PieChartModel pieModel;  
  
    public chartSupplierManagedBean() {  
        createCartesianModel();  
        createPieModel();  
    }  
  
    public CartesianChartModel getCartesianModel() {  
        return cartesianModel;  
    }  
  
    public PieChartModel getPieModel() {  
        return pieModel;  
    }  
  
    private void createCartesianModel() {  
        cartesianModel = new CartesianChartModel();  
  
        ChartSeries boys = new ChartSeries();  
        boys.setLabel("Boys");  
  
        boys.set("2004", 120);  
        boys.set("2005", 100);  
        boys.set("2006", 44);  
        boys.set("2007", 150);  
        boys.set("2008", 25);  
  
        ChartSeries girls = new ChartSeries();  
        girls.setLabel("Girls");  
  
        girls.set("2004", 52);  
        girls.set("2005", 60);  
        girls.set("2006", 110);  
        girls.set("2007", 135);  
        girls.set("2008", 120);  
  
        cartesianModel.addSeries(boys);  
        cartesianModel.addSeries(girls);  
    }  
  
    private void createPieModel() {  
        pieModel = new PieChartModel();  
  
        pieModel.set("Brand 1", 540);  
        pieModel.set("Brand 2", 325);  
        pieModel.set("Brand 3", 702);  
        pieModel.set("Brand 4", 421);  
    } 
    
}
